﻿using System;
using System.Configuration;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MediaDataModel;

namespace MediaClient
{
    public partial class BaseForm : Form
    {
        protected bool formMove = false;

        protected Point formPoint;

        protected User loginUser = null;

        public static string MessageBoxCaption = "消息提示";

        protected static string systemConfigFile = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"XML\SystemConfig.xml");

        protected static string capatureAppConfig = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ConfigurationManager.AppSettings["captureApp"]);

        protected static string lowFileExtension = ConfigurationManager.AppSettings["lowFileExtension"]??".wmv";

        protected static string videoAudioSplit = ConfigurationManager.AppSettings["videoAduioSplit"];

        public BaseForm()
        {
            InitializeComponent();
            
        }

        protected void pnlMainForm_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)//按下的是鼠标左键
            {
                formMove = false;//停止移动
            }
        }

        protected void pnlMainForm_MouseMove(object sender, MouseEventArgs e)
        {
            if (formMove == true)
            {
                Point mousePos = Control.MousePosition;
                mousePos.Offset(formPoint.X, formPoint.Y);
                Location = mousePos;
            }
        }

        protected void pnlMainForm_MouseDown(object sender, MouseEventArgs e)
        {
            formPoint = new Point();
            int xOffset;
            int yOffset;
            if (e.Button == MouseButtons.Left)
            {
                xOffset = -e.X - SystemInformation.FrameBorderSize.Width;
                yOffset = -e.Y - SystemInformation.FrameBorderSize.Height;//SystemInformation.CaptionHeight -
                formPoint = new Point(xOffset, yOffset);
                formMove = true;//开始移动
            }
        }
    }
}
